home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / shaolins.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  12KB  |  324 lines

  1. /***************************************************************************
  2.  
  3. Shaolin's Road
  4.  
  5. driver by Allard Van Der Bas
  6.  
  7. ***************************************************************************/
  8.  
  9. #include "driver.h"
  10. #include "vidhrdw/generic.h"
  11.  
  12.  
  13.  
  14. unsigned char *shaolins_nmi_enable;
  15. extern unsigned char *shaolins_scroll;
  16.  
  17. void shaolins_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  18. WRITE_HANDLER( shaolins_palettebank_w );
  19. void shaolins_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  20.  
  21.  
  22. int shaolins_interrupt(void)
  23. {
  24.     if (cpu_getiloops() == 0) return interrupt();
  25.     else if (cpu_getiloops() % 2)
  26.     {
  27.         if (*shaolins_nmi_enable & 0x02) return nmi_interrupt();
  28.     }
  29.  
  30.     return ignore_interrupt();
  31. }
  32.  
  33.  
  34.  
  35. static struct MemoryReadAddress readmem[] =
  36. {
  37.     { 0x0500, 0x0500, input_port_3_r },    /* Dipswitch settings */
  38.     { 0x0600, 0x0600, input_port_4_r },    /* Dipswitch settings */
  39.     { 0x0700, 0x0700, input_port_0_r },    /* coins + service */
  40.     { 0x0701, 0x0701, input_port_1_r },    /* player 1 controls */
  41.     { 0x0702, 0x0702, input_port_2_r },    /* player 2 controls */
  42.     { 0x0703, 0x0703, input_port_5_r },    /* selftest */
  43.     { 0x2800, 0x2bff, MRA_RAM },    /* RAM BANK 2 */
  44.     { 0x3000, 0x33ff, MRA_RAM },    /* RAM BANK 1 */
  45.     { 0x3800, 0x3fff, MRA_RAM },    /* video RAM */
  46.     { 0x4000, 0x5fff, MRA_ROM },    /* Machine checks for extra rom */
  47.     { 0x6000, 0xffff, MRA_ROM },
  48.     { -1 }  /* end of table */
  49. };
  50.  
  51. static struct MemoryWriteAddress writemem[] =
  52. {
  53.     { 0x0000, 0x0000, MWA_RAM, &shaolins_nmi_enable },    /* bit 1 = nmi enable, bit 2 = ? */
  54.                                                         /* bit 3, bit 4 = coin counters */
  55.     { 0x0100, 0x0100, watchdog_reset_w },
  56.     { 0x0300, 0x0300, SN76496_0_w },     /* trigger chip to read from latch. The program always */
  57.     { 0x0400, 0x0400, SN76496_1_w },     /* writes the same number as the latch, so we don't */
  58.                                         /* bother emulating them. */
  59.     { 0x0800, 0x0800, MWA_NOP },    /* latch for 76496 #0 */
  60.     { 0x1000, 0x1000, MWA_NOP },    /* latch for 76496 #1 */
  61.     { 0x1800, 0x1800, shaolins_palettebank_w },
  62.     { 0x2000, 0x2000, MWA_RAM, &shaolins_scroll },
  63.     { 0x2800, 0x2bff, MWA_RAM },    /* RAM BANK 2 */
  64.     { 0x3000, 0x30ff, MWA_RAM },    /* RAM BANK 1 */
  65.     { 0x3100, 0x33ff, MWA_RAM, &spriteram, &spriteram_size },
  66.     { 0x3800, 0x3bff, colorram_w, &colorram },
  67.     { 0x3c00, 0x3fff, videoram_w, &videoram, &videoram_size },
  68.     { 0x6000, 0xffff, MWA_ROM },
  69.     { -1 }  /* end of table */
  70. };
  71.  
  72.  
  73.  
  74. INPUT_PORTS_START( shaolins )
  75.     PORT_START    /* IN0 */
  76.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  77.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  78.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  79.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  80.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  81.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  82.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  83.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  84.  
  85.     PORT_START    /* IN1 */
  86.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
  87.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  88.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
  89.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
  90.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  91.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  92.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  93.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  94.  
  95.     PORT_START    /* IN2 */
  96.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_COCKTAIL )
  97.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  98.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_COCKTAIL )
  99.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_COCKTAIL )
  100.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  101.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  102.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  103.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  104.  
  105.     PORT_START    /* DSW0 */
  106.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  107.     PORT_DIPSETTING(    0x03, "2" )
  108.     PORT_DIPSETTING(    0x02, "3" )
  109.     PORT_DIPSETTING(    0x01, "5" )
  110.     PORT_DIPSETTING(    0x00, "7" )
  111.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
  112.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  113.     PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
  114.     PORT_DIPNAME( 0x18, 0x18, DEF_STR( Bonus_Life ) )
  115.     PORT_DIPSETTING(    0x18, "30000 70000" )
  116.     PORT_DIPSETTING(    0x10, "40000 80000" )
  117.     PORT_DIPSETTING(    0x08, "40000" )
  118.     PORT_DIPSETTING(    0x00, "50000" )
  119.     PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )
  120.     PORT_DIPSETTING(    0x60, "Easy" )
  121.     PORT_DIPSETTING(    0x40, "Medium" )
  122.     PORT_DIPSETTING(    0x20, "Hard" )
  123.     PORT_DIPSETTING(    0x00, "Hardest" )
  124.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  125.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  126.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  127.  
  128.     PORT_START    /* DSW1 */
  129.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  130.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  131.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  132.     PORT_DIPNAME( 0x02, 0x02, "Unknown DSW2 2" )
  133.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  134.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  135.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  136.     PORT_DIPNAME( 0x08, 0x08, "Unknown DSW2 4" )
  137.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  138.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  139.     PORT_DIPNAME( 0x10, 0x10, "Unknown DSW2 5" )
  140.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  141.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  142.     PORT_DIPNAME( 0x20, 0x20, "Unknown DSW2 6" )
  143.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  144.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  145.     PORT_DIPNAME( 0x40, 0x40, "Unknown DSW2 7" )
  146.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  147.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  148.     PORT_DIPNAME( 0x80, 0x80, "Unknown DSW2 8" )
  149.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  150.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  151.  
  152.     PORT_START    /* DSW2 */
  153.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  154.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  155.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  156.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  157.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  158.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  159.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  160.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  161.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  162.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  163.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  164.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  165.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  166.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  167.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  168.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  169.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  170.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  171.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  172.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  173.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  174.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  175.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  176.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  177.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  178.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  179.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  180.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  181.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  182.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  183.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  184.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  185.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  186. INPUT_PORTS_END
  187.  
  188.  
  189.  
  190. static struct GfxLayout shaolins_charlayout =
  191. {
  192.     8,8,    /* 8*8 chars */
  193.     512,    /* 512 characters */
  194.     4,    /* 4 bits per pixel */
  195.     { 512*16*8+4, 512*16*8+0, 4, 0 },
  196.     { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 },
  197.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  198.     16*8    /* every char takes 16 consecutive bytes */
  199. };
  200.  
  201. static struct GfxLayout shaolins_spritelayout =
  202. {
  203.     16,16,    /* 16*16 sprites */
  204.     256,    /* 256 sprites */
  205.     4,    /* 4 bits per pixel */
  206.     { 256*64*8+4, 256*64*8+0, 4, 0 },
  207.     { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3,
  208.             16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 },
  209.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  210.             32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
  211.     64*8    /* every sprite takes 64 consecutive bytes */
  212. };
  213.  
  214. static struct GfxDecodeInfo shaolins_gfxdecodeinfo[] =
  215. {
  216.     { REGION_GFX1, 0, &shaolins_charlayout,         0, 16*8 },
  217.     { REGION_GFX2, 0, &shaolins_spritelayout, 16*8*16, 16*8 },
  218.     { -1 } /* end of array */
  219. };
  220.  
  221.  
  222.  
  223. static struct SN76496interface sn76496_interface =
  224. {
  225.     2,    /* 2 chips */
  226.     { 1536000, 3072000 },    /* 3.072 Mhz???? */
  227.     { 100, 100 }
  228. };
  229.  
  230.  
  231.  
  232. static struct MachineDriver machine_driver_shaolins =
  233. {
  234.     /* basic machine hardware */
  235.     {
  236.         {
  237.             CPU_M6809,
  238.             1250000,        /* 1.25 Mhz */
  239.             readmem,writemem,0,0,
  240.             shaolins_interrupt,16    /* 1 IRQ + 8 NMI */
  241.         },
  242.     },
  243.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  244.     1,    /* single CPU, no need for interleaving */
  245.     0,
  246.  
  247.     /* video hardware */
  248.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  249.     shaolins_gfxdecodeinfo,
  250.     256,16*8*16+16*8*16,
  251.     shaolins_vh_convert_color_prom,
  252.  
  253.     VIDEO_TYPE_RASTER,
  254.     0,
  255.     generic_vh_start,
  256.     generic_vh_stop,
  257.     shaolins_vh_screenrefresh,
  258.  
  259.     /* sound hardware */
  260.     0,0,0,0,
  261.     {
  262.         {
  263.             SOUND_SN76496,
  264.             &sn76496_interface
  265.         }
  266.     }
  267. };
  268.  
  269.  
  270. /***************************************************************************
  271.  
  272.   Game driver(s)
  273.  
  274. ***************************************************************************/
  275.  
  276. ROM_START( kicker )
  277.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  278.     ROM_LOAD( "kikrd8.bin",   0x6000, 0x2000, 0x2598dfdd )
  279.     ROM_LOAD( "kikrd9.bin",   0x8000, 0x4000, 0x0cf0351a )
  280.     ROM_LOAD( "kikrd11.bin",  0xC000, 0x4000, 0x654037f8 )
  281.  
  282.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  283.     ROM_LOAD( "kikra10.bin",  0x0000, 0x2000, 0x4d156afc )
  284.     ROM_LOAD( "kikra11.bin",  0x2000, 0x2000, 0xff6ca5df )
  285.  
  286.     ROM_REGION( 0x8000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  287.     ROM_LOAD( "kikrh14.bin",  0x0000, 0x4000, 0xb94e645b )
  288.     ROM_LOAD( "kikrh13.bin",  0x4000, 0x4000, 0x61bbf797 )
  289.  
  290.     ROM_REGION( 0x0500, REGION_PROMS )
  291.     ROM_LOAD( "kicker.a12",   0x0000, 0x0100, 0xb09db4b4 ) /* palette red component */
  292.     ROM_LOAD( "kicker.a13",   0x0100, 0x0100, 0x270a2bf3 ) /* palette green component */
  293.     ROM_LOAD( "kicker.a14",   0x0200, 0x0100, 0x83e95ea8 ) /* palette blue component */
  294.     ROM_LOAD( "kicker.b8",    0x0300, 0x0100, 0xaa900724 ) /* character lookup table */
  295.     ROM_LOAD( "kicker.f16",   0x0400, 0x0100, 0x80009cf5 ) /* sprite lookup table */
  296. ROM_END
  297.  
  298. ROM_START( shaolins )
  299.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  300.     ROM_LOAD( "kikrd8.bin",   0x6000, 0x2000, 0x2598dfdd )
  301.     ROM_LOAD( "kikrd9.bin",   0x8000, 0x4000, 0x0cf0351a )
  302.     ROM_LOAD( "kikrd11.bin",  0xC000, 0x4000, 0x654037f8 )
  303.  
  304.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  305.     ROM_LOAD( "shaolins.6",   0x0000, 0x2000, 0xff18a7ed )
  306.     ROM_LOAD( "shaolins.7",   0x2000, 0x2000, 0x5f53ae61 )
  307.  
  308.     ROM_REGION( 0x8000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  309.     ROM_LOAD( "kikrh14.bin",  0x0000, 0x4000, 0xb94e645b )
  310.     ROM_LOAD( "kikrh13.bin",  0x4000, 0x4000, 0x61bbf797 )
  311.  
  312.     ROM_REGION( 0x0500, REGION_PROMS )
  313.     ROM_LOAD( "kicker.a12",   0x0000, 0x0100, 0xb09db4b4 ) /* palette red component */
  314.     ROM_LOAD( "kicker.a13",   0x0100, 0x0100, 0x270a2bf3 ) /* palette green component */
  315.     ROM_LOAD( "kicker.a14",   0x0200, 0x0100, 0x83e95ea8 ) /* palette blue component */
  316.     ROM_LOAD( "kicker.b8",    0x0300, 0x0100, 0xaa900724 ) /* character lookup table */
  317.     ROM_LOAD( "kicker.f16",   0x0400, 0x0100, 0x80009cf5 ) /* sprite lookup table */
  318. ROM_END
  319.  
  320.  
  321.  
  322. GAME( 1985, kicker,   0,      shaolins, shaolins, 0, ROT90, "Konami", "Kicker" )
  323. GAME( 1985, shaolins, kicker, shaolins, shaolins, 0, ROT90, "Konami", "Shao-Lin's Road" )
  324.